package org.openotdr.server.controller;

import org.openotdr.server.PropertyBuilder;
import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import com.miyake.rest.ServiceType;
import com.miyake.rest.WebServiceProperty;

public class ServiceListController extends Controller {

    @Override
    public Navigation run() throws Exception {
        if (isGet()) {
            WebServiceProperty prop = new PropertyBuilder() {

                @Override
                protected String getDescription() {
                   return "Service List";
                }

                @Override
                protected String getServiceName() {
                    return "Service List";
                }

                @Override
                protected String getServiceUrl() {
                    return "http://openotdr.appspot.com/serviceList";
                }

                @Override
                protected ServiceType getServiceType() {
                    return ServiceType.NotService;
                }

                @Override
                protected String getVersion() {
                    return "1.00";
                }
                
            }.getProperty();
            prop.getRelatedServices().add("http://openotdr.appspot.com/fileServlet");
            prop.getRelatedServices().add("http://openotdr.appspot.com/analyze");
            prop.setServiceType(ServiceType.NotService);
            this.response.getWriter().print(prop.toXML());
            this.response.getWriter().flush();
            this.response.getWriter().close();
        }
        return null;//forward("serviceList.jsp");
    }
}
